import axios from '../../utils/http'

const model = {
    namespaced: true, //形成对立的命名空间
    state: {
        //数据
        cateList: []
    },
    mutations: {
        cateListMutation(state,list){
            //设置数据
            state.cateList = list
        }
    },
    actions: {
        cateListActions(context){
            //请求数据
            axios.get("/catelist?istree=1").then(res=>{
                context.commit("cateListMutation",res.list)
            })
        }
    }
}

export default model